﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Text;

/// <summary>
///toole 的摘要说明
/// </summary>
public static class toole
{
    public static List<model> listmodel = new List<model>();
    public static List<HttpRequest> listrequest = new List<HttpRequest>();

    /// <summary>
    /// 向文件写入内容并根据bool append参数决定是改写还是追加 append=false则改写
    /// </summary>
    public static void WriteFile(string fileContent)
    {
        string file = @"C:\Project\SQLiteTest\aaa.txt";
        FileInfo info = new FileInfo(file);
        if (!Directory.Exists(info.DirectoryName))
        {
            Directory.CreateDirectory(info.DirectoryName);
        }
        StreamWriter writer = new StreamWriter(file, true, Encoding.GetEncoding("utf-8"));
        try
        {
            try
            {
                writer.Write(fileContent);
            }
            catch (Exception exception)
            {
                throw new FileNotFoundException(exception.ToString());
            }
        }
        finally
        {
            writer.Flush();
            writer.Close();
        }
    }
}